package c.d.a.a.i;

import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import c.d.a.a.j.c;
import c.d.a.a.j.f;
import c.d.a.a.j.g;
import c.d.a.a.j.h;
import java.util.Objects;

/* compiled from: AxisRenderer */
public abstract class a extends j {
    public c.d.a.a.b.a b;
    public f c;
    public Paint d;
    public Paint e;
    public Paint f;
    public Paint g;

    public a(h hVar, f fVar, c.d.a.a.b.a aVar) {
        super(hVar);
        this.c = fVar;
        this.b = aVar;
        if (hVar != null) {
            this.e = new Paint(1);
            Paint paint = new Paint();
            this.d = paint;
            paint.setColor(-7829368);
            this.d.setStrokeWidth(1.0f);
            this.d.setStyle(Style.STROKE);
            this.d.setAlpha(90);
            paint = new Paint();
            this.f = paint;
            paint.setColor(-16777216);
            this.f.setStrokeWidth(1.0f);
            this.f.setStyle(Style.STROKE);
            paint = new Paint(1);
            this.g = paint;
            paint.setStyle(Style.STROKE);
        }
    }

    public void a(float f, float f2, boolean z) {
        h hVar = this.a;
        if (!(hVar == null || hVar.b() <= 10.0f || this.a.d())) {
            float f3;
            double d;
            f fVar = this.c;
            RectF rectF = this.a.b;
            c b = fVar.b(rectF.left, rectF.top);
            f fVar2 = this.c;
            RectF rectF2 = this.a.b;
            c b2 = fVar2.b(rectF2.left, rectF2.bottom);
            if (z) {
                f3 = (float) b.c;
                d = b2.c;
            } else {
                f3 = (float) b2.c;
                d = b.c;
            }
            float f4 = (float) d;
            c.d.c(b);
            c.d.c(b2);
            f = f3;
            f2 = f4;
        }
        b(f, f2);
    }

    public void b(float f, float f2) {
        int i = this.b.o;
        double abs = (double) Math.abs(f2 - f);
        c.d.a.a.b.a aVar;
        if (i == 0 || abs <= 0.0d || Double.isInfinite(abs)) {
            aVar = this.b;
            aVar.k = new float[0];
            aVar.l = new float[0];
            aVar.m = 0;
            return;
        }
        double d;
        double i2 = (double) g.i(abs / ((double) i));
        Objects.requireNonNull(this.b);
        double i3 = (double) g.i(Math.pow(10.0d, (double) ((int) Math.log10(i2))));
        if (((int) (i2 / i3)) > 5) {
            i2 = Math.floor(i3 * 10.0d);
        }
        Objects.requireNonNull(this.b);
        Objects.requireNonNull(this.b);
        int i4 = (i2 > 0.0d ? 1 : (i2 == 0.0d ? 0 : -1));
        if (i4 == 0) {
            i3 = 0.0d;
        } else {
            i3 = Math.ceil(((double) f) / i2) * i2;
        }
        Objects.requireNonNull(this.b);
        if (i4 == 0) {
            d = 0.0d;
        } else {
            d = g.h(Math.floor(((double) f2) / i2) * i2);
        }
        if (i4 != 0) {
            i4 = 0;
            for (double d2 = i3; d2 <= d; d2 += i2) {
                i4++;
            }
        } else {
            i4 = 0;
        }
        aVar = this.b;
        aVar.m = i4;
        if (aVar.k.length < i4) {
            aVar.k = new float[i4];
        }
        for (int i5 = 0; i5 < i4; i5++) {
            if (i3 == 0.0d) {
                i3 = 0.0d;
            }
            this.b.k[i5] = (float) i3;
            i3 += i2;
        }
        if (i2 < 1.0d) {
            this.b.n = (int) Math.ceil(-Math.log10(i2));
        } else {
            this.b.n = 0;
        }
        Objects.requireNonNull(this.b);
    }
}
